package cn.com.huzo.service.trade.impl;

import cn.com.huzo.model.entities.trade.InspectionJournalLinesMaterialEntity;
import cn.com.huzo.repository.trade.InspectionJournalLinesMaterialRepository;
import huzofw.service.impl.GenericManagerImpl;
import cn.com.huzo.service.trade.InspectionJournalLinesMaterialManager;
import huzofw.common.util.annotations.WriteLog;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * 化检日记账-资材明细管理服务对象类实现。
 *
 * @author 范学春
 */
@Service("InspectionJournalLinesMaterialManager")
public class InspectionJournalLinesMaterialManagerImpl extends GenericManagerImpl<InspectionJournalLinesMaterialEntity, String>
        implements InspectionJournalLinesMaterialManager {

    @Resource(name = "InspectionJournalLinesMaterialRepository")
    private InspectionJournalLinesMaterialRepository _dao;

    /**
     * {@inheritDoc}
     *
     * @throws java.lang.Exception
     */
    @Override
    public List<InspectionJournalLinesMaterialEntity> fetchByHeaderKey(Long headerKey) throws Exception {
        return _dao.fetchByHeaderKey(headerKey);
    }

    /**
     * {@inheritDoc}
     *
     * @throws java.lang.Exception
     */
    @Override
    public List<InspectionJournalLinesMaterialEntity> fetchByNoOfStyle(Map<String, Object> matchValue) throws Exception {
        return _dao.fetchByNoOfStyle(matchValue);
    }

    /**
     * {@inheritDoc}
     *
     * @throws java.lang.Exception
     */
    @Override
    public List<InspectionJournalLinesMaterialEntity> fetchMaterialByNoOfStyle(Map<String, Object> matchValue) throws Exception {
        return _dao.fetchMaterialByNoOfStyle(matchValue);
    }

    /**
     * {@inheritDoc}
     *
     * @throws java.lang.Exception
     */
    @Override
    @WriteLog(modelName = "贸易管理→化检日记账资材明细", typeOfOperated = "增加")
    public Integer insertSelectedData(List<InspectionJournalLinesMaterialEntity> dataList) throws Exception {
        return _dao.insertSelectedData(dataList);
        /*List<InspectionJournalLinesMaterialEntity> dataList1 = new ArrayList();
        dataList1.add(dataList.get(0));

        return _dao.fetchByNoOfStyle(dataList1);*/
    }

    /**
     * {@inheritDoc}
     *
     * @throws java.lang.Exception
     */
    @Override
    @WriteLog(modelName = "贸易管理→化检日记账资材明细", typeOfOperated = "更新")
    public Integer update(List<InspectionJournalLinesMaterialEntity> dataList) throws Exception {
        return _dao.update(dataList);
    }

    /**
     * {@inheritDoc}
     *
     * @throws java.lang.Exception
     */
    @Override
    @WriteLog(modelName = "贸易管理→化检日记账资材明细", typeOfOperated = "删除")
    public Integer delete(InspectionJournalLinesMaterialEntity instance) throws Exception {
        return _dao.delete(instance.getLinesId());
    }

    /**
     * {@inheritDoc}
     *
     * @throws java.lang.Exception
     */
    @Override
    @WriteLog(modelName = "贸易管理→化简日记账资材明细", typeOfOperated = "批量删除")
    public Integer batchDeleteLines(List<InspectionJournalLinesMaterialEntity> dataList) throws Exception {
        return _dao.batchDeleteLines(dataList);
    }
}
